const session= {
  state: {
    token: null || localStorage.getItem('usertoken'),
    uid:null || localStorage.getItem('useruid')
  },
  getters: {
    NowToken(state){
      return state.token
    }
  },
  // 处理同步函数 修改state中数据
  mutations: {
    Regtoken (state,token) { 
      state.token = token
      localStorage.setItem('usertoken',token)
    },
    Chktoken (state){
      if(state.token === "") return false
      return true
    },
    Deltoken(state){
      state.token = ""
    },
    Reguid (state,uid) { 
      state.uid = uid
      localStorage.setItem('useruid',uid)
    },
    Chkuid (state){
      if(state.uid === "") return false
      return true
    },
    Deluid(state){
      state.uid = ""
    }
  },
  //处理异步函数 
  actions: {
  }
}

export default session
  